POV-Ray : Newsgroups : povray.general : rotate in #declare??? : rotate in #declare??? Server Time
2 Aug 2024 18:11:01 EDT (-0400)
  rotate in #declare???  
From: N Shomber
Date: 17 Aug 2004 15:24:16
Message: <41225b60$1@news.povray.org>
Hi,

I was working on creating a scene for POV-Comp using POV-Ray
3.6.1.icl8.win32 and came across this interesting behavior.

I am trying to declare an object that is rotated at some random angle around
an axis.  I need to create many of them so I declared a single instance
first then used a #while loop to create all of them.

I've found that if I include my rotate in the declaration, it doesn't make
it to the final object for some reason, but if I include it in the while
object declaration, it does.  Is this what's supposed to happen?

Sample code:

#declare R1=seed(0);

camera{
 location <0,00,-3>
 look_at <0,0,0>
}

#declare pole=
 cylinder{
  <0,0,0>,<0,1,0>,.01
  rotate <0,0,rand(R1)*360>
  pigment{
   rgb 1
  }
  finish{
   ambient 1
  }
 }
;

#declare c=100;
#while (c>0)
 object{
  pole
  translate <-1,0,0>
 }
 #declare c=c-1;
#end

#declare c=100;
#while (c>0)
 object{pole
  rotate <0,0,rand(R1)*360>
  translate <1,0,0>
 }
 #declare c=c-1;
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.